<template>
  <div>
    <publicPageVue :json-obj="pageSetting" name="LanguageManagement" :tables="tables" />
  </div>
</template>

<script>
  import { Mixin } from '@/common/minxin/Mixin'
  import { GFCD } from '@/utils/utils'
  import publicPageVue from '../../components/publicPage.vue'
  import { getList } from '../../api/home.js'
  import LanguageManagement from '../../components/json/LanguageManagement'
  const configSetting = GFCD('dams')
  export default {
    name: 'LanguageManagement',
    components: { publicPageVue },
    mixins: [Mixin],
    data() {
      return {
        // 选项卡列表
        tables: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'LanguageManagement',
          operation: false,
          isNew: true,
          isRefresh: true,
          isRedis: true,
          width: '150',
          uploadOptions: {
            postData: {
              method: 'dams.language.pack.import',
              data: '{}',
            },
            name: 'uploadFile',
            url: `${configSetting.domain}${configSetting.baseUrl}`,
          },
        },
        pageSetting: {},
        configSetting: {},
        show: false,
      }
    },
    created() {
      this.init()
    },
    methods: {
      async init() {
        this.configSetting = GFCD('dams')
        let res = await this.getSubsystemData()
        let list = []
        res.forEach((item) => {
          list.push({ CODE: item.CODE, LABEL: item.LABEL })
        })
        // this.nowJsonData().then((data) => {
        this.pageSetting = LanguageManagement
        let listField = this.pageSetting.LanguageManagement.dialog.form.field
        listField.forEach((item) => {
          if (item.name == 'SUB_SYSTEM') {
            item.options = list
          }
        })
        console.log(listField)
        // })
      },
      //获取子系统下拉数据
      async getSubsystemData() {
        let method = 'dams.handle.flow.query.options'
        let res = await getList(`${this.configSetting.domain}${this.configSetting.baseUrl}`, {
          method: method,
          data: JSON.stringify({ '#LIMIT#': 1, '#PAGE_SIZE#': 9999 }),
        })
        return res.data.SUB_SYSTEM.data
      },
    },
  }
</script>

<style lang="scss" scoped>
  :deep() {
    .vxe-table--render-default.border--full .vxe-body--column,
    .vxe-table--render-default.border--full .vxe-footer--column,
    .vxe-table--render-default.border--full .vxe-header--column {
      background-position: 100% 0, 100% 0;
    }
  }
</style>
